<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('智慧教育--学校信息列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>学校名称：</label>
                                <input type="text" name="schoolName" placeholder="请输入学校名称"/>
                            </li>

                            <li>
                                <label>学校地址：</label>
                                <input type="text" name="schoolAddress" placeholder="请输入学校地址"/>
                            </li>

                            <li>
                                <label>所属区划：</label>
                                <input type="text" name="schoolArea" placeholder="请选择所属区划"/>
                            </li>
                            <li>
                                <label>学段：</label>
                                <select name="schoolType">
                                    <option value="">请选择学段</option>
                                    <option value="1">幼儿园</option>
                                    <option value="2">小学</option>
                                    <option value="3">中学</option>
                                    <option value="4">高中</option>
                                    <option value="5">大学</option>
                                </select>
                            </li>


                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "school/district";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "智慧教育--学校信息",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'sid',
                    title: '主键id',
                    visible: false
                },
                {
                    field: 'schoolName',
                    title: '学校名称'
                },
                {
                    field: 'schoolLat',
                    title: '经度',
                    visible: false
                },
                {
                    field: 'schoolLng',
                    title: '纬度',
                    visible: false
                },
                {
                    field: 'schoolAddress',
                    title: '学校地址',
                    //表格超出宽度鼠标悬停显示td内容
                    formatter: function(value,row,index,field){
                        var span = document.createElement('span');
                        span.setAttribute('title',value);
                        span.innerHTML = value;
                        return span.outerHTML;
                    },
                    //td宽度及内容超过宽度隐藏
                    cellStyle : function(value, row, index, field){
                        return {
                            css: {"min-width": '100px',
                                "white-space": 'nowrap',
                                "text-overflow": 'ellipsis',
                                "overflow": 'hidden',
                                "max-width":'150px'
                            }
                        }
                    }
                },
                {
                    field: 'advisoryPhone',
                    title: '咨询电话'
                },
                {
                    field: 'schoolArea',
                    title: '所属区划'
                },
                {
                    field: 'schoolType',
                    title: '学段',
                    formatter: function(value,row,index,field){
                        switch (value) {
                            case "1":
                                return "幼儿园";
                            case "2":
                                return "小学";
                            case "3":
                                return "中学";
                            case "4":
                                return "高中";
                            case "5":
                                return "大学";
                        }
                    },
                },
                {
                    field: 'schoolPic',
                    title: '学校场景图',
                    visible: false
                },
                {
                    field: 'introduce',
                    title: '学校简介',
                    visible: false
                },
                {
                    field: 'teachArea',
                    title: '施教范围文字描述',
                    visible: false
                },
                {
                    field: 'teachAreaPoint',
                    title: '施教范围标注坐标json',
                    visible: false
                },
                {
                    field: 'teachAreaOuterLine',
                    title: '施教范围多边形坐标json',
                    visible: false
                },
                {
                    field: 'deleteflag',
                    title: '1 不删除 2删除' ,
                    visible: false
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs '  + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.sid + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.sid + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>
